<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>节点移动</title>
    <style>
        .all{
            display: flex;
        }
        select{
            width: 150px;
            height:200px;
        }
        .btn{
            width: 50px;
        }
    </style>
</head>
<body>
    <div class="all">
        <select id="leftSelect" multiple>
            <option value="">张飞</option>
            <option value="">关羽</option>
            <option value="">刘备</option>
            <option value="">曹操</option>
            <option value="">诸葛亮</option>
        </select>
        <div class="btn">
            <input id="moveToRight" type="button" value=">">
            <input type="button" value=">>">
            <input type="button" value="<">
            <input type="button" value="<<">
        </div>
        <select id="rightSelect" multiple></select>
        <input type="button" value="up">
        <input type="button" value="down">
    </div>
    <script>
        let leftSelect = document.getElementById("leftSelect");
        let rightSelect = document.getElementById("rightSelect");
        document.getElementById("moveToRight").onclick = function(){
            // let opts = leftSelect.options;
            // console.log(opts);
            let opts = document.querySelectorAll("#leftSelect>option");
            for(let i = 0;i < opts.length;i++){
                if(opts[i].selected){
                    rightSelect.appendChild(opts[i]);
                }
            } 
        }
    </script>
</body>
</html>